/* 
测试:
    联合体 + 结构体 占用内存大小
    联合体如何影响 结构体大小
 */
#include <stdint.h>
#include <stdio.h>

struct Demo {
  union {
    uint32_t val;
    struct {
      uint8_t a;
      uint8_t b;
      uint8_t c;
      uint8_t d;
    } data_byte;
  } data;
};

int main()
{
  struct Demo demo;
  printf("struct Demo %lu\n", sizeof(struct Demo));
  printf("struct demo.data %lu\n", sizeof(demo.data.val));
  printf("struct demo.data_byte %lu\n", sizeof(demo.data.data_byte));

  return 0;
}
/* 
struct Demo 4
struct demo.data 4
struct demo.data_byte 4
 */